package com.moli.iov.base.model;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.moli.iov.base.model.po.SysParamSettings;
import com.moli.iov.base.util.CollectionUtils;
import java.util.List;
import org.apache.commons.lang3.StringUtils;

/**
 * The type Sys param settings param.
 *
 * @author wanghualin
 * @date 2019 -10-08 20:16:37
 */
public class SysParamSettingsParam {
  private QueryWrapper<SysParamSettings> queryWrapper;

  public SysParamSettingsParam() {
    queryWrapper = new QueryWrapper<>();
    queryWrapper.eq("is_delete", 0);
  }

  public QueryWrapper<SysParamSettings> get() {
    return queryWrapper;
  }


  public SysParamSettingsParam queryEqParamCode(String paramCode) {
    if (!StringUtils.isEmpty(paramCode)) {
      queryWrapper.eq("param_code", paramCode);
    }
    return this;
  }

  public SysParamSettingsParam queryEqUserId(Long userId) {
    if (userId != null) {
      queryWrapper.eq("user_id", userId);
    }
    return this;
  }

  public SysParamSettingsParam queryEqCompanyId(Long companyId) {
    if (companyId != null) {
      queryWrapper.eq("company_id", companyId);
    }
    return this;
  }
  public SysParamSettingsParam queryInCompanyId(List<Long> companyId) {
    if (CollectionUtils.isEmpty(companyId)) {
      queryWrapper.in("company_id", companyId);
    }
    return this;
  }
}
